package Thread_Test;

/**
 * Created by asd73 on 2017/8/16.
 */
public class Thread_Test {
    public static void main(String[] args){
        MyThread1 m1 = new MyThread1();
        MyThread1 m2 = new MyThread1();
        MyThread1 m3 = new MyThread1();
        new Thread(m1).start();
        new Thread(m2).start();
        new Thread(m3).start();
    }

}


class MyThread1 extends Thread{

    private synchronized void mythread(){
        System.out.println("synchronized");
    }
    @Override
    public void run() {
        for (int i=0;i<10;i++){
            System.out.println("thread"+i);
            mythread();
        }
    }
}


